package com.gitee.zhengjiasen.dp.state.demo1;

public class Bubble {

    // 关联灯泡有2状态
    StateOn stateOn = new StateOn(this);
    StateOff stateOff = new StateOff(this);


    // 设置电灯的默认状态
    StateBubble stateBubble = stateOff;

    //电灯打开, 电灯去调用状态的on方法.
    public void on() {
        stateBubble.on();
    }

    //电灯关闭, 电灯去调用状态的off方法.
    public void off() {
        stateBubble.off();
    }


    //设置灯泡的状态.
    public String getStateBubble() {
        return stateBubble.describe;
    }

    public void setStateBubble(StateBubble stateBubble) {
        this.stateBubble = stateBubble;
    }

    // 以下是状态的get和set
    public StateOn getStateOn() {
        return stateOn;
    }


    public StateOff getStateOff() {
        return stateOff;
    }


}
